home *** CD-ROM | disk | FTP | other *** search
/ Graphics & Sound Program…ng Techniques for the Mac / Graphics and Sound Programming Techniques for the Mac.iso / M&T Graphics & Sound Examples / Symantec Versions / C08 QuickTime Music / P03 Pick Instrument / PickInstrument.c next >
Encoding:
C/C++ Source or Header  |  1995-08-05  |  1.6 KB  |  73 lines  |  [TEXT/KAHL]

  1.  
  2. //____________________________________________________________
  3. //    PickInstruments.c
  4. //
  5. //    Copyright © Dan Parks Sydow, 1995
  6. //    From the book:
  7. //    "Graphics and Sound Programming Techniques for the Mac",
  8. //    M&T Books, 1995
  9.  
  10.  
  11. //____________________________________________________________
  12.  
  13. #include <QuickTimeComponents.h>
  14.  
  15.  
  16. //____________________________________________________________
  17.  
  18. void  InitializeToolbox( void );
  19. void  InitializeInstrument( void );
  20.  
  21.  
  22. //____________________________________________________________
  23.  
  24. NoteAllocator    gNoteAllocatorComp;
  25. ToneDescription  gToneDesc;
  26.  
  27.  
  28. //____________________________________________________________
  29.  
  30. void  main( void )
  31. {
  32.    ComponentResult  theResult;
  33.    Str31            thePrompt = "\pSelect an instrument:";
  34.  
  35.    InitializeToolbox();
  36.  
  37.    InitializeInstrument();
  38.  
  39.    theResult = NAPickInstrument( gNoteAllocatorComp, nil, thePrompt, 
  40.                                  &gToneDesc, 0, 0, 0, 0 );
  41.    if ( theResult != noErr )
  42.       ExitToShell();
  43. }
  44.  
  45.  
  46. //____________________________________________________________
  47.  
  48. void InitializeInstrument( void )
  49. {
  50.    gNoteAllocatorComp = OpenDefaultComponent( kNoteAllocatorType, 0 );
  51.  
  52.    gToneDesc.synthesizerType = 0;
  53.    gToneDesc.synthesizerName[0] = 0;
  54.    gToneDesc.instrumentName[0] = 0;
  55.    gToneDesc.instrumentNumber = 0;
  56.    gToneDesc.gmNumber = 0;
  57. }
  58.  
  59.  
  60. //____________________________________________________________
  61.  
  62. void  InitializeToolbox( void )
  63. {
  64.    InitGraf( &qd.thePort );
  65.    InitFonts();
  66.    InitWindows();
  67.    InitMenus();
  68.    TEInit();
  69.    InitDialogs( 0L );
  70.    FlushEvents( everyEvent, 0 );
  71.    InitCursor();
  72. }
  73.